# 数组相关的使用方法

# init array - > 没有内置的数组 但是有一个更加具有扩展性的数据结构数组


class myArray():
    def __init__(self, len, cap):
        self.len = len
        self.cap = cap
        self.myArray = [] * len

    def initArray(self):
        return myArray.myArray

    def addElem(self,e):
        if self.isfull:
            return False
        self.myArray.append(e)
        return True

    def delElem(self,n):
        if not self.isEmpty:
            return False
        e = self.myArray[n-1]
        return e

    @property
    def isEmpty(self):
        return False if self.len <= 0 else True

    @property
    def isfull(self):
        return True if self.len >= self.cap else False

    def forarry(self):
        return [i for i in self.myArray]

if __name__ == '__main__':
    myArray = myArray(10, 20)
    print(myArray.initArray())
    print(myArray.isEmpty)
    print(myArray.isfull)
    print(myArray.addElem(1))
    print(myArray.forarry())
    print(myArray.delElem(1))

